package com.tfswue.qmp.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tfswue.qmp.entity.User1;
import com.tfswue.qmp.service.User1Sesrvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    private User1Sesrvice user1Sesrvice;
    @RequestMapping("/getUser")
    public String getUser()
    {
//        return String.valueOf(user1Sesrvice.getById(1));

//        QueryWrapper条件查询器,list()==select * from user where id=? and username=?
//        queryWrapper.eq("id",1).eq("username","admin");
//        select * from user where id=1 and username="admin"
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("id",3);
        queryWrapper.like("username","a");
        List<User1> list = user1Sesrvice.list(queryWrapper);
        return String.valueOf(list);

    }
}
